package com.lsk.mps.backend.model;

import com.lsk.mps.backend.util.HashUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class User {
    private Integer id;
    private String username;
    private transient String password;
    private String role;

    public static User fromExcelUser(UserExcel userExcel) {
        User user = new User();
        user.setUsername(userExcel.getUsername());
        user.setPassword(HashUtil.sha256String(userExcel.getPassword()));
        user.setRole(userExcel.getRole());
        return user;
    }
}
